package com.emo.wowoblog.controller;

import com.emo.wowoblog.dao.QuestionTypeMongoDao;
import com.emo.wowoblog.mongo.entity.QuestionType;
import com.emo.wowoblog.service.QuestionTypeService;
import com.emo.wowoblog.vo.HttpResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/question")
public class QuestionControllerMongoController {

    @Autowired
    QuestionTypeMongoDao questionTypeMongoDao;

    @GetMapping("/queryAllQuestionType")
    public Map<String, Object> findAllQuestionType() {
        try {
            List<QuestionType> questionTypes = questionTypeMongoDao.findAll();
            return HttpResult.success(questionTypes);
        } catch (Exception e) {
            e.printStackTrace();
            return HttpResult.fail("获取所有问题种类失败！");
        }
    }

}
